const gulp = require("gulp");
// const { youdao, baidu, google } = require('translation.js');
var through = require('through2');
const translate = require('@vitalets/google-translate-api');
const tunnel = require('tunnel');
const fs = require("fs");
const tap = require("gulp-tap");
var commands = [];

// const projectId = '1028064353330-ujtb5s9umuevgiriba2kj78jshujsn3b.apps.googleusercontent.com';
// const {Translate} = require('@google-cloud/translate').v2;
// const translate = new Translate({projectId});
// wanglin-google-001
function cp_src() {
  // return gulp.src('app/base/html/**/*')
  //   .pipe(through.obj(function (file, enc, callback) {
  //     this.push(file.path);

  //     callback();
  //   })).on('data', function (data) {
  //     console.log(`data=${data}`)
  //     commands.push(data);
  //   })

  return gulp.src('app/base/html/**/*')
    .pipe(gulp.dest('app/base/html_EN'))
}

function google_translate_src() {
  let hasPar = {
    "首页": "Homepage",
    "初始化": "initialization",
    "成功": "success",
    "失败": "failure",
    "设备启动中": "Device start",
    "业务一卡通": "Business card",
    "地铁": "subway",
    "语音客服": "Voice service",
    "客服电话": "consumer hotline",
    "退出": "drop out",
    "横屏": "Horizontal screen",
    "购卡": "Buy card",
    "买卡": "Buy card",
    "充值": "Recharge",
    "退卡": "check out",
    "学生卡": "student card",
    "办理学生卡": "Student card",
    "发票": "invoice",
    "打印": "print",
    "发票打印": "Invoice print",
    "咨询": "advisory",
    "挂失": "Lane",
    "卡片挂失": "Card loss",
    "延期": "extension",
    "卡片延期": "Card extension",
    "余额": "Balance",
    "查询余额": "Check balances",
    "客服": "Customer service",
    "人工客服": "Artificial service",
    "您可以这么对我说": "Can you tell me?",
    "我要充值": "I want to recharge",
    "常见问题快捷入口": "Frequently Asked Questions Quick Entrance",
    "打印发票": "Print invoice",
    "联系客服": "Contact Customer Service",
    "你可以这样问我": "You can ask me like this",
    "我要办理学生卡": "I want to handle a student card",
    "我要打印电子发票": "I want to print an electronic invoice",
    "我要买卡": "I want to buy a card",
    "我要退卡": "I want to return the card",
    "我要联系客服": "I want to contact customer service",
    "请说话": "please speak",
    "客服热线": "Customer service hotline",
    "按住说话": "Press and hold",
    "已开发票打印": "Voted print",
    "退资": "Fund",
    "欢迎使用自助充值系统": "Welcome to the self-service recharge system",
    "余额查询": "Balance query",
    "下一页": "Next page",
    "设备维护中": "Equipment maintenance",
    "进站异常": "Entering exception",
    "出站异常": "Outbound",
    "补出站票": "Set out the ticket",
    "实名登记": "Real name registration",
    "您可以对我说": "You can tell me",
    "请按页面提示": "Please press the page prompt",
    "将深圳通放入验卡区": "Put Shenzhen Tong into the inspection area",
    "首": "first",
    "页": "page",
    "剩余操作时间": "Remainder",
    "验证失败": "verification failed",
    "温馨提示": "Tips",
    "未检测到您的卡片": "No card",
    "解挂失确认": "Solution loss confirmation",
    "您的卡片信息": "Your card information",
    "卡": "card",
    "号": "number",
    "余": "Remainder",
    "额": "amount",
    "元": "yuan",
    "确认解挂": "Confirmation",
    "处理中": "Processing",
    "卡片解挂失处理中": "Card solution loss",
    "请勿移走您的卡片": "Do not remove your card",
    "解挂失失败": "Loss loss failure",
    "卡片解挂失操作失败": "Card solution failure failed",
    "如需再次办理延期业务": "If you need to handle the extended business",
    "请返回首页重新办理": "Please return to the home page to re-handle",
    "挂失已受理": "Loss has been accepted",
    "卡片解挂失操作成功": "Card solution loss exercise success",
    "请取走您的卡片": "Please take your card",
    "充值劵": "Recharge voucher",
    "放卡": "Discipline",
    "您正在办理": "You are handling",
    "将": "will",
    "放入充值区": "Recharge area",
    "查询中": "Inquiry",
    "放入": "put into a",
    "取走": "Take away",
    "卡号": "card number",
    "正在查询": "querying",
    "请勿移动卡片": "Do not move cards",
    "选择充值券": "Select the recharge voucher",
    "购买日期": "Purchase date",
    "充": "Charge",
    "值": "value",
    "检测及处理": "Detection and processing",
    "异常票卡": "Abnormal ticket card",
    "放入检测区": "Put into the detection area",
    "检测卡片": "Detection card",
    "正在为您确认交通卡信息": "Conduct traffic card information for you",
    "请不要移动卡片": "Please do not move cards",
    "请稍后": "please wait",
    "检测结果": "Test results",
    "您的卡片无进站记录": "Your card has no station record",
    "需要您选择进入的站点": "Need you choose to enter the site",
    "正在为您录入进站信息": "Being entered into the station information for you",
    "入站点为": "Attempt",
    "世界之窗": "Window of the world",
    "处理成功": "Handle success",
    "业务处理成功": "Business handling success",
    "请取走您的交通卡": "Please take your traffic card",
    "现在您可直接刷卡出站": "Now you can directly swipe out",
    "处理失败": "Process failure",
    "业务处理失败": "Business handling failed",
    "寻找现场工作人员帮助您处理问题": "Looking for on-site staff to help you handle problems",
    "充值业务": "Recharge business",
    "将交通卡放入验卡区": "Put the traffic card into the inspection area",
    "记录查询": "Record inquiry",
    "交易日期": "transaction date",
    "交易时间": "transaction hour",
    "交易摘要": "Trading Summary",
    "交易金额": "Transaction amount",
    "最近": "recent",
    "笔": "pen",
    "交易记录": "Transaction Record",
    "补充值": "Supplementary value",
    "通话时间": "Call time",
    "放身份证": "Put identity card",
    "验证信息": "verify message",
    "照片录入": "Photo entry",
    "信息上传": "Upload",
    "将身份证放入感应区": "Put your ID card in the induction area",
    "登记失败": "Registration failed",
    "失败原因显示": "Reason for failure",
    "验证成功": "Verification success",
    "登记成功": "Registration success",
    "今后您可以不带身份证进出边门": "In the future, you can bring out the door without an ID card.",
    "拍摄照片": "taking photos",
    "尊敬的用户": "respected user",
    "您已满足边门登记的条件": "You have met the condition of the door registration",
    "即将为您进行拍照": "Soon to take pictures",
    "请看摄像头": "Please see the camera",
    "照片确认": "Photo confirmation",
    "如果您对拍摄的照片满意": "If you are satisfied with the photo of the photographed",
    "请点击确定按钮完成拍照": "Please click OK button to complete the photo",
    "否则请重新拍照": "Otherwise, please re-take",
    "重新拍摄": "Re-shoot",
    "确": "Indeed",
    "认": "recognize",
    "验证中": "Verify",
    "正在为您保存信息": "Save information for you",
    "请稍候": "Please wait",
    "选择支付方式": "Select Payment Method",
    "当前余额": "current balance",
    "扫码支付": "Scanning code payment",
    "现金支付": "cash payment",
    "付款": "payment",
    "向左的箭头": "Arrow to the left",
    "支付宝支付": "pay by AliPay",
    "支付宝": "Alipay",
    "扫一扫": "scan it",
    "应付金额": "Amounts payable",
    "支付完成后": "Payment is completed",
    "请勿取走卡片": "Do not take the card",
    "放弃充值": "Abandon",
    "请投入一张": "Please invest one",
    "元纸币": "Yuan banknote",
    "建行龙支付": "CCB payment",
    "合并支付": "Merge payment",
    "需支付": "Need to pay",
    "支付完成前请勿移动卡片": "Do not move cards before payment",
    "微信支付": "WeChat payment",
    "微信": "WeChat",
    "充值中": "Recharge",
    "正在确认付款信息": "Confirm payment information",
    "等待系统为您充值": "Waiting for your recharge",
    "充值失败": "Recharge failed",
    "请重新放置您的交通卡": "Please reset your traffic card",
    "并点击": "Click",
    "充值成功": "Recharge success",
    "请取走你的深圳通卡片": "Please take your Shenzhen pass card",
    "打印凭条": "Print",
    "补充值流程": "Supplementary value process",
    "回首页": "Back home",
    "查余额": "Check the balance",
    "关注": "attention",
    "交通卡小管家": "Traffic card small tube",
    "微信公众号": "WeChat public account",
    "随时完成退款申请": "Complete a refund application at any time",
    "充值异常": "Recharge exception",
    "请拨打免费热线": "Please call the free hotline",
    "进行人工处理": "Manual treatment",
    "选择挂失类型": "Select the type of loss",
    "挂失业务": "Lane",
    "信息确认中": "Information confirmation",
    "正在读取身份信息": "Reading identity information",
    "身份获取失败": "Identity acquisition failed",
    "身份验证失败": "Authentication failed",
    "未能在您的身份证名下找到可挂失的深圳通卡": "Shenzhen Tongka that cannot be lost under your ID card",
    "请核对您的身份证信息": "Please check your ID card information",
    "重新验证": "Re-verification",
    "读取信息成功": "Reading information success",
    "姓名": "Name",
    "参考余额": "Reference balance",
    "身份验证成功": "Authentication success",
    "请扫描二维码并在手机端进行挂失": "Please scan the QR code and make a loss on the phone.",
    "挂失受理后": "After the loss is accepted",
    "卡内余额": "Card balance",
    "天后自动退还到您的扫码账户": "Automatically returned to your scan code",
    "挂失的学生卡将无法使用": "The lost student card will not be available",
    "业务处理中": "Business processing",
    "扫码成功": "Scan code success",
    "请尽快在手机端完成": "Please complete the mobile phone end as soon as possible",
    "信息确认操作": "Information confirmation operation",
    "挂失申请已取消": "Losetted application has been canceled",
    "如需再次办理挂失业务": "If you need to handle the loss service again",
    "挂失申请已受理": "The report is accepted",
    "您的挂失申请我们已经受理": "We have already accepted your report",
    "个工作日后相关资金将自动退回至您的扫码账户": "Related funds will be automatically returned to your scan code account after work.",
    "请注意查收": "Please pay attention to check",
    "售卡": "Sales card",
    "选择": "select",
    "购卡业务": "Buy card business",
    "出错了": "error",
    "聚合支付": "Aggregate payment",
    "请选择支付方式": "Please select the payment method",
    "放弃购卡": "Give up the purchase card",
    "请扫描下方二维码付款": "Please scan the QR code payment below",
    "请不要离开": "Please don't leave",
    "等待系统为您出卡": "Waiting for your card",
    "购卡失败": "Purchase card failed",
    "请联系客服进行处理": "Please contact customer service for processing",
    "购卡成功": "Successful purchase card",
    "您已成功购卡": "You have successfully purchased a card",
    "请取走您的深圳通卡": "Please take your Shenzhen Tongka",
    "您卡里不含充值金": "Your card does not contain recharged gold",
    "点击此处": "click here",
    "立即充值": "Recharge immediately",
    "购卡异常": "Card abnormality",
    "出站票": "Run away",
    "支付": "Pay",
    "出站票业务": "Outbound ticket business",
    "请扫描下方二维码购买出站票": "Please scan the QR code to purchase the ticket",
    "放弃购买": "Give up",
    "出票中": "Passport",
    "您已扫二维码": "You have scanned QR code",
    "是否放弃购卡": "Whether to give up purchase card",
    "是": "Yes",
    "否": "no",
    "请取走您的出站票": "Please take your outbound ticket",
    "主页面": "main page",
    "学生卡业务": "Student card business",
    "本人办理": "I personally",
    "需准备本人身份证": "Need to prepare your ID card",
    "他人代办": "Other person",
    "与代办人身份证": "Agency ID card",
    "放入身份证": "Into ID card",
    "信息完善": "Perfect information",
    "发卡激活": "Card activation",
    "身份信息确认": "Identity information confirmation",
    "学生姓名": "student name",
    "生日": "birthday",
    "性别": "gender",
    "民族": "Nation",
    "身份证号": "identity number",
    "身份证地址": "ID card address",
    "身份证有效期": "ID card validity",
    "下一步": "Next step",
    "本机只支持": "This machine only supports",
    "周岁以下学生办理学生卡": "Student's cards under the age of age",
    "已办理学生卡不可重复办理": "Student card has been handled",
    "已购买但未激活的学生卡可直接进行激活操作": "A student card that has been purchased but unconnected can be directly activated",
    "代办人身份识别完成": "Agent identification completion",
    "请使用微信扫描二维码完善信息": "Please use WeChat scan QR code to improve information",
    "激": "Excitement",
    "活": "live",
    "学生卡办理失败": "Student card failed",
    "学生卡办理成功": "Student card is successful",
    "请取走您的学生卡": "Please take your student card",
    "结果显示": "The results show that",
    "站点选择": "Site selection",
    "二维码扫描": "QR code scan",
    "出票": "Ticketing",
    "取走单程票": "Take a single ticket",
    "起点": "starting point",
    "终点": "end",
    "深大": "Deep",
    "购票数量": "Number of ticket purchases",
    "张": "Open",
    "售价": "Price",
    "购": "purchase",
    "买": "buy",
    "单程票": "a one-way ticket",
    "选择页面": "Select page",
    "请选择购票方式": "Please select the ticket purchase method",
    "票": "ticket",
    "取": "take",
    "返": "return",
    "回": "Back",
    "扫描二维码": "Scan QR code",
    "数量": "Quantity",
    "放弃购票": "Give up ticket purchase",
    "将取票二维码对准扫描区": "Align the ticket area",
    "自助一体机": "Self-service",
    "定": "set",
    "出卡中": "Out of the card",
    "正在出票中": "Be in the ticket",
    "请稍侯": "Please a little",
    "业务失败": "Business failure",
    "取票失败": "Take ticket failure",
    "业务成功": "Business success",
    "出票成功": "Successful ticket",
    "您已成功购票": "You have successfully purchased tickets",
    "请取走您的单程票": "Please take your one-way ticket",
    "退卡主页面": "Return the home page",
    "退卡申请": "Refund application",
    "插入深圳通": "Insert Shenzhen Tong",
    "确认退卡信息": "Confirm that the return information",
    "退卡完成": "Finish",
    "请用支付宝扫描以下二维码": "Please use Alipay to scan the following QR code",
    "退卡须知": "Repeated card",
    "本机暂只支持办理押金版卡退卡业务": "This machine only supports the deposit version of the card and retreat business",
    "退卡成功后": "After successful",
    "押金卡将予回收": "The deposit card will be recycled",
    "退卡资金退还至您的": "Returned to your return",
    "账户": "Account",
    "退卡信息确认": "Return information confirmation",
    "请输入退款码": "Please enter a refund",
    "清空": "Empty",
    "确认": "confirm",
    "插卡": "Card",
    "请插入深圳通": "Please insert Shenzhen Tong",
    "自助售卡充值机": "Self-help card recharge machine",
    "深圳通": "Shenzhen Tong",
    "请确认退卡信息": "Please confirm the return information",
    "发行方式": "Release method",
    "押金": "deposit",
    "可退金额": "Rewind amount",
    "确认退卡": "Confirmation",
    "退卡中": "Backhand",
    "业务办理中": "Business handling",
    "退卡失败": "Failure",
    "退卡成功": "Successful",
    "退卡金额已成功划拨至您的支付宝账户": "The amount of return card has been successfully allocated to your Alipay account",
    "请及时查看": "Please check in time",
    "退卡错误提示": "Returning error prompt",
    "您的支付宝账号": "Your Alipay account",
    "小时内退卡数量超过": "The number of retained cards exceeded",
    "请更换支付宝收款或明日再试": "Please replace Alipay collection or try tomorrow",
    "错误提示": "Error message",
    "提醒": "remind",
    "放入验卡区": "Introduction to the inspection area",
    "补充": "supplement",
    "放弃": "give up",
    "确认信息": "Confirmation",
    "过期时间": "expire date",
    "年": "year",
    "月": "month",
    "日": "day",
    "本次操作可给卡片延期": "This operation can be extended to the card",
    "确认延期": "Confirmation",
    "正在为您的卡片延期": "I am extension for your card",
    "请勿移走卡片": "Do not remove the card",
    "业务处理异常": "Business processing exception",
    "并移步人工进行处理": "And move manually",
    "处理异常": "Abnormal treatment",
    "扫码": "Scan code",
    "现金": "cash",
    "支付完成前勿移动卡片": "Do not move cards before payment",
    "是否放弃充值": "Whether to give up recharge",
    "支付中": "payment ongoing",
    "您已扫描二维码": "You have scanned QR code",
    "等待您支付完成": "Waiting for your payment",
    "请多尝试补充值": "Please try additional value",
    "退款": "Refund",
    "凭条": "Dependent",
    "你好少年你叫什么名字": "Hello teenage, what is your name?",
    "请使用": "please use",
    "或": "or",
    "扫描二维码并按指引进行电子发票领取": "Scan the QR code and take an electronic invoice according to the guide",
    "上传发票图片": "Upload invoice picture",
    "取走纸质发票": "Take the paper invoice",
    "请使用微信扫描二维码并按指引进行电子发票打印": "Please use WeChat to scan the QR code and press the electronic invoice print according to the guide",
    "上传发票界面": "Upload invoice interface",
    "取走发票": "Take away invoices",
    "验证": "verification",
    "取走身份证": "Take away the ID card",
    "身份证验证成功": "ID card verification success",
    "正在为您查询挂失信息": "I am querying the lost information for you.",
    "请扫描下方二维码": "Please scan the QR code below",
    "并在手机端进行挂失": "And lost at the phone",
    "挂失须知": "Phase III",
    "请尽快在手机端": "Please be on the phone as soon as possible",
    "完成信息确认操作": "Complete information confirmation",
    "如需再次办理挂失业务请返回首页重新办理": "If you need to apply a loss service again, please return to the home page to re-handle it.",
    "卡片信息": "Card information",
    "含": "Contain",
    "元充值金": "Yuan recharge gold",
    "说明": "Description",
    "返回": "return",
    "立即购买": "Buy now",
    "购买": "buy",
    "第": "First",
    "章": "chapter",
    "卖完了": "Sold out",
    "确定": "determine",
    "您需支付": "You need to pay",
    "您正在进行": "You are going on",
    "操作": "operating",
    "您正在进行购卡操作": "You are making a card operation",
    "您已扫码二维码": "You have scanned QR code",
    "本人": "Myself",
    "他人": "others",
    "代办": "Active",
    "确定领卡": "Determine the collar card",
    "请输入您登记的手机号": "Please enter your mobile phone number you registered",
    "请使用微信扫描二维码": "Please use WeChat to scan QR code",
    "符合学生卡办理条件": "Compliance with student card processing conditions",
    "请使用微信扫描右侧二维码": "Please use WeChat to scan the two-dimensional code",
    "一": "One",
    "二": "two",
    "三": "three",
    "四": "four",
    "五": "Fives",
    "六": "six",
    "七": "Seven",
    "八": "Eight",
    "九": "nine",
    "零": "zero",
    "等待系统为您出票": "Waiting for your ticket for you",
    "年审": "Annual review",
    "老年卡年审业务": "Alternative card annual review business",
    "放老年卡": "Elderly card",
    "将需要年审的老年卡放入验卡区": "Put the old cards that need the annual review",
    "您已满足办理老年卡年审的条件": "You have met the conditions for the elderly card year",
    "退": "Retreat",
    "出": "Out",
    "人证一致校验": "Unison",
    "照片拍摄成功": "Photo shooting success",
    "人证一致校验中": "Uniform verification",
    "写卡": "Write card",
    "人证一致验证通过": "Unpected verification",
    "请勿离开": "Do not leave",
    "正在为您办理年审": "Working for your annual trial",
    "办理成功": "Successful",
    "办理失败": "Handle failure",
    "解挂失": "Resolve",
    "解挂失业务": "Unspeakable business",
    "将需要解挂的卡放入验卡区": "The card will be given to the card inspection area",
    "信息校验中": "Information verification",
    "信息校验成功": "Information verification success",
    "解挂失处理中": "Solve loss",
    "如需再次办理解挂失业务": "If you need to make an understanding of the hanging business",
    "解挂失成功": "Solve success",
    "您的卡片可以正常使用": "Your card can be used normally",
    "解挂失异常": "Solution loss abnormality",
    "扫描二维码并按指引进行电子发票打印": "Scan the QR code and press the guide to print",
    "您的深圳通卡不能在充值处充值": "Your Shenzhen Tongka cannot recharge at the recharge",
    "请至客服处办理充值": "Please check the customer service",
    "数字人民币支付": "Digital RMB payment",
    "银联闪付": "UnionPay flash payment",
    "在图示位置刷银联卡": "Brush UnionPay card on the graphic location",
    "您已付款成功": "You have been successful",
    "补": "Make up",
    "点击打印凭条": "Click to print a book",
    "领取发票": "Receive invoices",
    "领取": "receive",
    "读取三面一起侧面屏配置文件": "Read three side panel configuration files",
    "为": "for",
    "时为侧面屏": "Side screen",
    "其余为正面屏": "The rest is a front screen",
    "领取电子发票": "Receive an electronic invoice",
    "选择挂失卡片类型": "Select the lost lost card type",
    "请选择挂失的卡类型": "Please select a lost card type",
    "学生卡挂失": "Student card lost",
    "老年卡挂失": "Elderly card",
    "残疾人卡挂失": "Disabled card",
    "儿童卡挂失": "Children's card",
    "重新": "Re-re-",
    "老年卡办理": "Alternative card",
    "红外活体检测": "Infrared living detection",
    "老年卡业务": "Old card business",
    "请点击开始认证按钮进行人证验证": "Please click to start the authentication button to perform a human card verification",
    "如果无法准确定位到人脸": "If you can't accurately locate your face",
    "您可左右轻移一下位置": "You can slightly slightly slightly",
    "开始": "Start",
    "认证": "Certification",
    "开始认证": "Start certification",
    "启动中": "starting",
    "请确认需挂失的卡片信息": "Please confirm the card information that needs to be lost",
    "您已完成确认挂失操作": "You have completed confirmation",
    "挂失处理中": "Laid loss",
    "挂失受理失败": "Continued failure",
    "结果提示页面": "Results prompt page",
    "此设备暂不支持此功能": "This device does not support this feature",
    "数字人民币": "Digital RMB",
    "请扫描右侧二维码付款": "Please scan the 2nd-dimensional code payment",
    "银联闪付支付": "UnionPay flash payment",
    "办理申请": "Apply for an application",
    "身份证读取成功": "ID card reading success",
    "办理申请中": "Application",
    "校验身份证失败": "Calibration ID card failed",
    "未感应到您的身份证": "Not inherent to your ID card",
    "请重新放置您的身份证并点击": "Please reset your ID card and click",
    "按钮": "Button",
    "确认照片": "Confirmation",
    "您已满足办理老年卡的条件": "You have met the conditions for the elderly card",
    "办理须知": "Tips",
    "您的办理申请": "Your application",
    "审核通过": "examination passed",
    "请扫描": "Please scan",
    "右侧二维码": "Right two-dimensional code",
    "完成支付": "Complete payment",
    "打印中": "Printed",
    "卡片已激活": "Card activated",
    "正在为您打印卡片": "Print card for you",
    "卡片激活": "Card activation",
    "已完成支付": "Payment has been paid",
    "正在为您办卡": "Being a card for you",
    "成功支付": "payment successful",
    "请取走您的老年卡": "Please take your old card",
    "请输入手机号码": "Please enter the phone number",
    "请使用微信扫描下方二维码": "Please use WeChat to scan the QR code",
    "退卡业务": "Retire",
    "支付宝或者微信": "Alipay or WeChat",
    "扫描右侧二维码": "Scan the two-dimensional code on the right side",
    "本机暂只支持办理": "This machine is temporarily supported",
    "押金版卡退卡业务": "Deposit version of the card retreat business",
    "本卡退卡资金将退还至您的": "This card returns will be returned to you.",
    "扫码账户": "Scan code account",
    "支持": "stand by",
    "请确认信息并输入退款码": "Please confirm the information and enter a refund",
    "将深圳通卡插入退卡口": "Insert Shenzhen Tongka into the retracting port",
    "等待系统完成退卡操作": "Waiting for the system to complete the return card",
    "或者": "or",
    "拨打免费热线": "Call the free hotline",
    "金额和押金已成功划拨至您的扫码账户": "The amount and deposit have been successfully allocated to your scan code account",
    "退还金额": "Refund",
    "退资主页面": "Lead main page",
    "退资业务": "Funds business",
    "退资须知": "Guidance",
    "购卡费": "Card fee",
    "不可退": "Not retreat",
    "退卡后无法再激活": "I can't activate it after returning the card.",
    "退资成功后": "After the fund is successful",
    "卡片不予回收": "Card is not recycled",
    "本卡退资资金将退还至您的": "The funds funds will be returned to you.",
    "退资信息确认": "Levy information confirmation",
    "确认退资信息": "Confirm funds",
    "请确认退资信息": "Please confirm the funding information",
    "普通卡": "regular card",
    "卡余额": "Balance",
    "购卡费不可退": "Cannot purchase card fee",
    "确认退资": "Confirm funds",
    "退资中": "Inlet",
    "等待系统完成退资操作": "Waiting for the system to complete the funding operation",
    "退资失败": "Failover",
    "退资成功": "Successful funds",
    "退资错误提示": "Level misunderstanding",
    "小时内退资数量超过": "The amount of funds in the hour exceeded",
    "进站异常业务": "Entering anomalous business",
    "正在为您录入上次出站信息": "I am entering you outline information",
    "出站点为": "Outlet",
    "白石洲": "Banyan",
    "现在您可直接刷卡进站": "Now you can directly swipe the card",
    "出站异常业务": "Outbound abnormal business",
    "补缴金额": "Pay a payment amount",
    "请扫描右方二维码付款": "Please scan the QR code payment of the right",
    "放弃支付": "Give up payment",
    "需支付金额": "Need to pay",
    "岗厦北": "Gangxia North",
    "市民中心": "Civic center",
    "福田": "Futian",
    "莲花西": "Lotus West",
    "景甜": "Sweet",
    "香梅北": "Xiangmei North",
    "实名认证": "Verified",
    "以后您可以不带身份证进出边门": "After you can bring your ID card",
    "补出站票业务": "Put out of the station ticket business",
    "请扫描右边二维码购买出站票": "Please scan the QR code to purchase out the ticket"
  };
  return gulp.src('app/base/html_EN/**/*.html')
    .pipe(through.obj({ enc: "utf-8" }, async function (file, enc, callback) {
      console.log(enc)
      console.log(file.path)
      let contents = file.contents.toString();
      var reg = /[\u4e00-\u9fa5]+/g;
      let chList = contents.match(reg);
      try {
        for (let i = 0; i < chList.length; i++) {
          let chunk = chList[i];
          if (hasPar[chunk]) {
            contents = contents.replace(chunk, hasPar[chunk]);
          }
          else {
            let res = await translate(chunk, { from: 'zh-CN', to: 'en', client: 't', tld: 'cn' });
            hasPar[chunk] = res.text;
            contents = contents.replace(chunk, res.text);
          }
        }
      } catch (error) {
        console.log(`error = ${error}`);
      }
      file.contents = new Buffer(contents);
      this.push(file);
      fs.writeFile('hasPar.txt', JSON.stringify(hasPar), function (err) {
        if (err) console.error(err);
        console.log('写入数据');
      })
      callback();
      return
      let text = contents.split('');  // >5k chars
      const chunks = [];
      console.log(text.length);
      console.log(text);
      while (text.length) chunks.push(text.splice(0, 5000).join(''));
      let resText = "";
      console.log(chunks.length);
      for (let i = 0; i < chunks.length; i++) {
        let chunk = chunks[i];
        let res = await translate(chunk, { from: 'zh-CN', to: 'en', client: 't', tld: 'cn', type: 'html' });
        let end = res.text.replace(RegExp(" / ", "g"), "/");
        resText += end;
      }
      console.log(`resText = ${resText}`);
      file.contents = new Buffer(resText);
      this.push(file);
      callback();
    })).pipe(gulp.dest('app/base/html_EN/'))
}


function translate_class_src() {
  return gulp.src('app/base/html_EN/**/*.html')
    .pipe(through.obj({ enc: "utf-8" }, async function (file, enc, callback) {
      let contents = file.contents.toString();
      let end = contents.replace(RegExp("Class", "g"), "class");
      file.contents = new Buffer(end);
      this.push(file);
      callback();
    })).pipe(gulp.dest('app/base/html_EN/'))

}

//任务顺序执行 parallel() 并发执行
exports.default = gulp.series(cp_src);
exports.translate = gulp.series(google_translate_src);
exports.tClass = gulp.series(translate_class_src);
